#ifndef DATAPACKAGE_H
#define DATAPACKAGE_H

#include <QObject>

#include "BaseGlobal.h"
#include "BaseStruct.h"

class QSqlQuery;
class BASE_EXPORT DataPackage : public QObject
{
	Q_OBJECT

public:
	DataPackage(QObject *parent = 0);
	~DataPackage();

public:
	QString getError();

public:
	bool request(QByteArray & data);
	bool request(const QString & SQL, QByteArray & data);
	bool request(const QString & send, JsonDataType Type, QByteArray & data);

	bool response(QByteArray & data);
	bool response(QSqlQuery & query, QByteArray & data);
	bool response(const QString & recieve, const QString & Error, QByteArray & data);
	

private:
	QJsonValue toJsonValue(const QVariant & value);

private:
	QString strError;

};

#endif // DATAPACKAGE_H
